#include <stdio.h>
#include <memory.h>
#include <iostream>
using namespace std;

int n = 0;
int cacheMax = 0;
string *orgMap;
string *map;

/**
 * .x..
 * ....
 * xx..
 * ....
 */
bool isCanAdd(int x, int y, string *list) {
    string str = list[x];
    if (str[y] != '.') {
        return false;
    }
    bool isLeftStore = false;
    bool isRightStore = false;
    bool isUpStore = false;
    bool isBottomStore = false;
    for (int i = 1; i < n; i++)
    {
        if (y - i >= 0 && !isLeftStore)
        {
            char left = str[y - i];
            if (left == 'o') {
                return false;
            }
            if (left == 'X') {
                isLeftStore = true;
            }
        } else if (y - i < 0){
            isLeftStore  = true;
        }

        if (y + i < n && !isRightStore)
        {
            char right = str[y + i];
            if (right == 'o')
            {
                return false;
            }
            if (right == 'X')
            {
                isRightStore = true;
            }
        } else if (y + i >= n){
            isRightStore = true;
        }

        if (x - i >= 0 && !isUpStore)
        {
            char up = list[x - i][y];
            if (up == 'o')
            {
                return false;
            }
            if (up == 'X')
            {
                isUpStore = true;
            }
        } else if (x - i < 0){
            isUpStore  = true;
        }

        if (x + i < n && !isBottomStore)
        {
            char bottom = list[x + i][y];
            if (bottom == 'o')
            {
                return false;
            }
            if (bottom == 'X')
            {
                isBottomStore = true;
            }
        } else if (y + i >= n){
            isBottomStore = true;
        }
        if (isRightStore && isLeftStore && isUpStore && isBottomStore)
        {
            break;
        }
    }
    return true;
}

int m = 0;
void dfs(int startX, int startY)
{
    for (int y = 0; y < n; y++)
    {
        for (int x = 0; x < n; x++)
        {
            if (isCanAdd(x, y, map))
            {
                map[x][y] = 'o';
                m++;
                if (m > cacheMax)
                {
                    cacheMax = m;
                }
                dfs(x, y);
                m--;
                map[x][y] = orgMap[x][y];
            }
        }
    }
}

int main()
{
    while (cin >> n)
    {
        if (n == 0) break;
        cacheMax = 0;
        orgMap = new string[n];
        map = new string[n];
        for (int i = 0; i < n; i++)
        {
            string str;
            cin >> str;
            orgMap[i] = str;
            map[i] = str;
        }
        dfs(0, 0);
        cout << cacheMax << endl;
        delete[] orgMap;
        delete[] map;
    }

    return 0;
}